<?php
session_start();
if ((!isset($_SESSION['login']))) {
header("Location: Acesso_Negado.php");
}

$db = mysql_connect ("localhost", "root" ,"");
$basedados = mysql_select_db("redesocial", $db);
 

$logindeletar = $_SESSION['login'];
$contador = 0;

$query = "select * from usuarios";
$result = mysql_query($query);

while ($row = mysql_fetch_array($result)) {
        if ($logindeletar == $row['login'])
         $codigo = $row['cod'];
        mysql_query(" DELETE FROM `redesocial`.`usuarios` WHERE `usuarios`.`cod` = '$codigo' ");
         $contador = 007;   
        }

if ($contador == 0){
    echo("Erro ao deletar usuario. <br>");
} else if ($contador == 007){
    echo("Usuario deletado com sucesso! <br> ");
}
header("Location: Logout.php");
class deletar {
    //put your code here
}

?>

<https><body>
        <a href="Main.php">Menu Principal</a>
 <a href="login.php">Login</a> 
    </body></https>
